package Code;

import com.jcraft.jsch.*;

public class SSHTunnel{

	public boolean Connect(String Address,String DatabaseAddress,String User,String Password,int SSHPort,int LocalPort,int RemotePort){
	
		JSch jsch=new JSch();
		
		try{
			Session SSHSession=jsch.getSession(User,Address,SSHPort);   
			SSHSession.setPassword(Password);
			SSHSession.setConfig("StrictHostKeyChecking","no");
			SSHSession.setPortForwardingL(LocalPort,DatabaseAddress,RemotePort);
			SSHSession.connect(1000);
			return true;
		}catch(Exception e){
			return false;
		}
	}

}
